<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Album View</title>
	</head>
	<body>
		<!-- user login/logout -->
		<s:if test="logged==true">
			<div style="text-align:rigth"><s:property value="loggedUser"/>&nbsp;<a href="logout">Logout</a></div>
		</s:if>
		<s:else>
			<div style="text-align:rigth"><a href="login">Login</a></div>
		</s:else>
		<!-- content -->
		<table>
			<s:if test="logged==true">
				<tr><td><a href="albumEdit?catalog=${album.catalog}"><s:text name="edit"/></a></td></tr>
			</s:if>
			<tr><td>
				<!-- Header -->
				<table>
					<tr>
						<td><img width="150" src="image/${album.catalog}.jpg" /></td>
						<td>
							<table>
								<tr>
									<td>
										<h1>
											<s:iterator value="album.artists">
												<a href="artistView?name=${name}"><s:property value="name"/></a>&nbsp;
											</s:iterator>
											<br>
											${album.title}
										</h1>
									</td>
								</tr>
								<tr>
									<td>
										<!-- Details -->
										<table>
											<tr><td>Label:</td><td>Балкантон ${album.catalog}</td></tr>
											<tr><td>Format:</td><td>${album.format}</td></tr>
											<tr><td>Released:</td><td>${album.released}</td></tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td></tr>
			<tr><td>
				<!-- Tracks -->
				<table>
					<tr style="background-color:grey;"><th>Pos:</th><th>Title:</th><th>Duration:</th></tr>
					<s:iterator value="album.tracks">
						<tr>
							<td><s:property value="position"/></td>
							<td><s:property value="title"/></td>
							<td><s:property value="duration"/></td>
						</tr>
					</s:iterator>
				</table>
			</td></tr>
			<tr><td>
				<!-- Credits -->
				<table>
					<tr style="background-color:grey;"><th>Role:</th><th>Name:</th><th>Tracks:</th></tr>
					<s:iterator value="album.credits">
						<tr>
							<td><s:property value="role"/></td>
							<td>
								<s:iterator value="artists">
									<a href="artistView?name=${name}"><s:property value="name"/></a>&nbsp;
								</s:iterator>
							</td>
							<td><s:property value="tracks"/></td>
						</tr>
					</s:iterator>
				</table>
			</td></tr>
		</table>
	</body>
</html>